package com.ostrich.module_community.ui

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.alibaba.android.arouter.facade.annotation.Route
import com.gyf.immersionbar.ImmersionBar
import com.ostrich.library_base.BaseFragment
import com.ostrich.library_common.route.RouterFragmentPath
import com.ostrich.module_community.R
import com.ostrich.module_community.adapter.CommunityFragmentAdapter
import com.ostrich.module_community.attention.AttentionFragment
import com.ostrich.module_community.databinding.CommunityFragmentCommunityBinding
import com.ostrich.module_community.recommend.RecommendFragment

@Route(path = RouterFragmentPath.PAGER_COMMUNITY)
class CommunityFragment : BaseFragment<CommunityFragmentCommunityBinding>() {
    private val titles = mutableListOf<String>()
    private val fragments = mutableListOf<Fragment>()
    private lateinit var communityFragmentAdapter: CommunityFragmentAdapter
    init {
        titles+="推荐"
        titles+="关注"
        fragments+=RecommendFragment()
        fragments+=AttentionFragment()

    }
    override fun initView() {
        binding?.let {
            communityFragmentAdapter = CommunityFragmentAdapter(titles, fragments,childFragmentManager)
            it.vpHomeContent.adapter = communityFragmentAdapter
            it.tabLayout.setupWithViewPager(it.vpHomeContent)

        }

    }

    override fun initData() {

    }

    override fun initListener() {

    }

    override fun bindLayout(): Int {
      return R.layout.community_fragment_community
    }


    override fun onResume() {
        super.onResume()
        ImmersionBar.with(this)
            .fitsSystemWindows(true)
            .statusBarColor(R.color.purple_200)
            .autoStatusBarDarkModeEnable(true,0.2f)
            .init()
    }


}